#
# GerikSpell.py
# Created by Gerikes for GerikSpells

import CvUtil
from CvPythonExtensions import *

gc = CyGlobalContext()

class GerikSpellBase:
    def __init__(self):
        self.m_eSpell = -1
        self.m_pCastingGroup = None
        self.m_pCastingPlot = None

    def getSpellNumber(self):
        return self.m_eSpell

    def setSpellNumber(self, eSpell):
        self.m_eSpell = eSpell

    def getCastingGroup(self):
        return self.m_pCastingGroup

    def setCastingGroup(self, pGroup):
        self.m_pCastingGroup = pGroup

    def getCastingPlot(self):
        return self.m_pCastingPlot

    def setCastingPlot(self, pPlot):
        self.m_pCastingPlot = pPlot

    def startSpell(self, pSelectionGroup, pCastingPlot, bAlt, bShift, bCtrl):
        """
        Arguments:
            pSelectionGroup: The CySelectionGroup object that was selected when the spell was activated.
            pCastingPlot: The plot that the group will be on when the spell is cast.
            bAlt: Boolean True/False if the alt key was held down when activating.
            bShift: Boolean True/False if the shift key was held down when activating.
            bCtrl: Boolean True/False if the Ctrl key was held down when activating.
        Returns:
            None

        This function is typically overridden by the Handler policy your spell uses. It is called whenever
        a player presses the action button for a spell or hits the hotkey. For a targetting spell, this
        starts the targetting process.
        """
        self.setCastingGroup(pSelectionGroup)
        self.setCastingPlot(pCastingPlot)
        self.start(bAlt, bShift, bCtrl)

    def getHelpText(self, pSelectedGroup, pPlot):
        """
        Arguments:
            pSelectedGroup: The selected group when the help text should be displayed.
            pPlot: The plot that the spell would be called on if selected.
        Returns:
            The string that should be shown as the help text.

        Override this function to display a help text when a user hovers over a spell's button
        located in the action button list on the bottom of the screen.
        """
        return ""

    def getUnitHelpText(self, pUnit):
        """
        Arguments:
            pUnit: The CyUnit object representing the unit that we're making the help text for.
        Returns:
            A string that should be shown as the help text.

        Override this function to display a help text after a unit's information in the info pane
        when hovering over a plot. This is typically where you would see something like:
        "Building Road (5 turns)".
        """
        return ""

    def pushSpellMission(self, iData1, iData2, iData3):
        """
        Arguments:
            iData1: The generic integer data1
            iData2: The generic integer data2
            iData3: The generic integer data3
            iFlags: Interface flags

        Returns:
            none

        This is used when you wish to push a spell's mission. Using this rather than the pushMission will ensure
        that the spell's number is inserted into the internal data structure used to store missions (if the
        spell number is not there, it's impossible to tell what spell is being cast when the mission is
        at the top of the queue).
        """
        gc.pushSpellMission(self.getSpellNumber(), iData1, iData2, iData3)

    def pushSpellMissionAltShift(self, iData1, iData2, iFlags, bAlt, bShift):
        """
        Arguments:
            iData1: The generic integer data1
            iData2: The generic integer data2
            iData3: The generic integer data3
            iFlags: Interface flags
            bAlt: If the "alt" key is pressed.
            bShift: If the "shift" key is pressed (actually, used for appending missions to queue)

        Returns:
            None
        """
        gc.pushSpellMissionAltShift(self.getSpellNumber(), iData1, iData2, iFlags, bAlt, bShift)
        

    
